{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Defaulting to user installation because normal site-packages is not writeable\n",
      "Looking in indexes: https://mirrors.cloud.aliyuncs.com/pypi/simple\n",
      "Requirement already satisfied: matplotlib>=3.2.2 in /home/admin/.local/lib/python3.6/site-packages (from -r requirements.txt (line 4)) (3.3.4)\n",
      "Requirement already satisfied: numpy>=1.18.5 in /home/admin/.local/lib/python3.6/site-packages (from -r requirements.txt (line 5)) (1.19.5)\n",
      "Requirement already satisfied: opencv-python>=4.1.2 in /home/admin/.local/lib/python3.6/site-packages (from -r requirements.txt (line 6)) (4.2.0.32)\n",
      "Requirement already satisfied: Pillow>=7.1.2 in /home/admin/.local/lib/python3.6/site-packages (from -r requirements.txt (line 7)) (8.0.1)\n",
      "Requirement already satisfied: PyYAML>=5.3.1 in /home/admin/.local/lib/python3.6/site-packages (from -r requirements.txt (line 8)) (5.3.1)\n",
      "Requirement already satisfied: requests>=2.23.0 in /home/admin/.local/lib/python3.6/site-packages (from -r requirements.txt (line 9)) (2.25.0)\n",
      "Requirement already satisfied: scipy>=1.4.1 in /home/admin/.local/lib/python3.6/site-packages (from -r requirements.txt (line 10)) (1.4.1)\n",
      "Requirement already satisfied: torch>=1.7.0 in /home/admin/.local/lib/python3.6/site-packages (from -r requirements.txt (line 11)) (1.10.0)\n",
      "Requirement already satisfied: torchvision>=0.8.1 in /home/admin/.local/lib/python3.6/site-packages (from -r requirements.txt (line 12)) (0.11.1)\n",
      "Requirement already satisfied: tqdm>=4.41.0 in /home/admin/.local/lib/python3.6/site-packages (from -r requirements.txt (line 13)) (4.53.0)\n",
      "Requirement already satisfied: tensorboard>=2.4.1 in /home/admin/.local/lib/python3.6/site-packages (from -r requirements.txt (line 16)) (2.7.0)\n",
      "Requirement already satisfied: pandas>=1.1.4 in /home/admin/.local/lib/python3.6/site-packages (from -r requirements.txt (line 20)) (1.1.5)\n",
      "Requirement already satisfied: seaborn>=0.11.0 in /home/admin/.local/lib/python3.6/site-packages (from -r requirements.txt (line 21)) (0.11.2)\n",
      "Requirement already satisfied: thop in /home/admin/.local/lib/python3.6/site-packages (from -r requirements.txt (line 36)) (0.0.31.post2005241907)\n",
      "Requirement already satisfied: cycler>=0.10 in /home/admin/.local/lib/python3.6/site-packages (from matplotlib>=3.2.2->-r requirements.txt (line 4)) (0.10.0)\n",
      "Requirement already satisfied: kiwisolver>=1.0.1 in /home/admin/.local/lib/python3.6/site-packages (from matplotlib>=3.2.2->-r requirements.txt (line 4)) (1.3.1)\n",
      "Requirement already satisfied: python-dateutil>=2.1 in /home/admin/.local/lib/python3.6/site-packages (from matplotlib>=3.2.2->-r requirements.txt (line 4)) (2.8.0)\n",
      "Requirement already satisfied: pyparsing!=2.0.4,!=2.1.2,!=2.1.6,>=2.0.3 in /home/admin/.local/lib/python3.6/site-packages (from matplotlib>=3.2.2->-r requirements.txt (line 4)) (2.4.7)\n",
      "Requirement already satisfied: idna<3,>=2.5 in /home/admin/.local/lib/python3.6/site-packages (from requests>=2.23.0->-r requirements.txt (line 9)) (2.10)\n",
      "Requirement already satisfied: certifi>=2017.4.17 in /home/admin/.local/lib/python3.6/site-packages (from requests>=2.23.0->-r requirements.txt (line 9)) (2020.11.8)\n",
      "Requirement already satisfied: chardet<4,>=3.0.2 in /home/admin/.local/lib/python3.6/site-packages (from requests>=2.23.0->-r requirements.txt (line 9)) (3.0.4)\n",
      "Requirement already satisfied: urllib3<1.27,>=1.21.1 in /home/admin/.local/lib/python3.6/site-packages (from requests>=2.23.0->-r requirements.txt (line 9)) (1.26.2)\n",
      "Requirement already satisfied: typing-extensions in /home/admin/.local/lib/python3.6/site-packages (from torch>=1.7.0->-r requirements.txt (line 11)) (3.7.4.3)\n",
      "Requirement already satisfied: dataclasses; python_version < \"3.7\" in /home/admin/.local/lib/python3.6/site-packages (from torch>=1.7.0->-r requirements.txt (line 11)) (0.8)\n",
      "Requirement already satisfied: protobuf>=3.6.0 in /home/admin/.local/lib/python3.6/site-packages (from tensorboard>=2.4.1->-r requirements.txt (line 16)) (3.14.0)\n",
      "Requirement already satisfied: grpcio>=1.24.3 in /home/admin/.local/lib/python3.6/site-packages (from tensorboard>=2.4.1->-r requirements.txt (line 16)) (1.33.2)\n",
      "Requirement already satisfied: markdown>=2.6.8 in /home/admin/.local/lib/python3.6/site-packages (from tensorboard>=2.4.1->-r requirements.txt (line 16)) (3.3.3)\n",
      "Requirement already satisfied: tensorboard-data-server<0.7.0,>=0.6.0 in /home/admin/.local/lib/python3.6/site-packages (from tensorboard>=2.4.1->-r requirements.txt (line 16)) (0.6.1)\n",
      "Requirement already satisfied: tensorboard-plugin-wit>=1.6.0 in /home/admin/.local/lib/python3.6/site-packages (from tensorboard>=2.4.1->-r requirements.txt (line 16)) (1.8.0)\n",
      "Requirement already satisfied: google-auth-oauthlib<0.5,>=0.4.1 in /home/admin/.local/lib/python3.6/site-packages (from tensorboard>=2.4.1->-r requirements.txt (line 16)) (0.4.2)\n",
      "Requirement already satisfied: setuptools>=41.0.0 in /usr/local/lib/python3.6/dist-packages (from tensorboard>=2.4.1->-r requirements.txt (line 16)) (50.3.2)\n",
      "Requirement already satisfied: wheel>=0.26 in /home/admin/.local/lib/python3.6/site-packages (from tensorboard>=2.4.1->-r requirements.txt (line 16)) (0.35.1)\n",
      "Requirement already satisfied: google-auth<3,>=1.6.3 in /home/admin/.local/lib/python3.6/site-packages (from tensorboard>=2.4.1->-r requirements.txt (line 16)) (1.23.0)\n",
      "Requirement already satisfied: werkzeug>=0.11.15 in /home/admin/.local/lib/python3.6/site-packages (from tensorboard>=2.4.1->-r requirements.txt (line 16)) (1.0.1)\n",
      "Requirement already satisfied: absl-py>=0.4 in /home/admin/.local/lib/python3.6/site-packages (from tensorboard>=2.4.1->-r requirements.txt (line 16)) (0.11.0)\n",
      "Requirement already satisfied: pytz>=2017.2 in /home/admin/.local/lib/python3.6/site-packages (from pandas>=1.1.4->-r requirements.txt (line 20)) (2020.4)\n",
      "Requirement already satisfied: six in /home/admin/.local/lib/python3.6/site-packages (from cycler>=0.10->matplotlib>=3.2.2->-r requirements.txt (line 4)) (1.15.0)\n",
      "Requirement already satisfied: importlib-metadata; python_version < \"3.8\" in /usr/local/lib/python3.6/dist-packages (from markdown>=2.6.8->tensorboard>=2.4.1->-r requirements.txt (line 16)) (3.1.0)\n",
      "Requirement already satisfied: requests-oauthlib>=0.7.0 in /home/admin/.local/lib/python3.6/site-packages (from google-auth-oauthlib<0.5,>=0.4.1->tensorboard>=2.4.1->-r requirements.txt (line 16)) (1.3.0)\n",
      "Requirement already satisfied: pyasn1-modules>=0.2.1 in /home/admin/.local/lib/python3.6/site-packages (from google-auth<3,>=1.6.3->tensorboard>=2.4.1->-r requirements.txt (line 16)) (0.2.8)\n",
      "Requirement already satisfied: rsa<5,>=3.1.4; python_version >= \"3.5\" in /home/admin/.local/lib/python3.6/site-packages (from google-auth<3,>=1.6.3->tensorboard>=2.4.1->-r requirements.txt (line 16)) (4.6)\n",
      "Requirement already satisfied: cachetools<5.0,>=2.0.0 in /home/admin/.local/lib/python3.6/site-packages (from google-auth<3,>=1.6.3->tensorboard>=2.4.1->-r requirements.txt (line 16)) (4.1.1)\n",
      "Requirement already satisfied: zipp>=0.5 in /usr/local/lib/python3.6/dist-packages (from importlib-metadata; python_version < \"3.8\"->markdown>=2.6.8->tensorboard>=2.4.1->-r requirements.txt (line 16)) (3.4.0)\n",
      "Requirement already satisfied: oauthlib>=3.0.0 in /home/admin/.local/lib/python3.6/site-packages (from requests-oauthlib>=0.7.0->google-auth-oauthlib<0.5,>=0.4.1->tensorboard>=2.4.1->-r requirements.txt (line 16)) (3.1.0)\n",
      "Requirement already satisfied: pyasn1<0.5.0,>=0.4.6 in /home/admin/.local/lib/python3.6/site-packages (from pyasn1-modules>=0.2.1->google-auth<3,>=1.6.3->tensorboard>=2.4.1->-r requirements.txt (line 16)) (0.4.8)\n",
      "\u001b[33mWARNING: You are using pip version 20.2.4; however, version 21.3.1 is available.\n",
      "You should consider upgrading via the '/usr/bin/python -m pip install --upgrade pip' command.\u001b[0m\n",
      "Note: you may need to restart the kernel to use updated packages.\n"
     ]
    }
   ],
   "source": [
    "pip install -r requirements.txt"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Package                   Version\n",
      "------------------------- ---------------------\n",
      "absl-py                   0.11.0\n",
      "aliyun-python-sdk-core    2.13.5\n",
      "aliyun-python-sdk-core-v3 2.13.3\n",
      "aliyun-python-sdk-kms     2.7.1\n",
      "argon2-cffi               20.1.0\n",
      "asn1crypto                0.23.0\n",
      "astor                     0.8.0\n",
      "astunparse                1.6.3\n",
      "async-generator           1.10\n",
      "attrs                     20.3.0\n",
      "backcall                  0.2.0\n",
      "bleach                    3.2.1\n",
      "cachetools                4.2.1\n",
      "certifi                   2020.12.5\n",
      "cffi                      1.14.4\n",
      "chardet                   4.0.0\n",
      "cloudpickle               1.6.0\n",
      "conda                     4.9.2\n",
      "conda-package-handling    1.3.11\n",
      "crcmod                    1.7\n",
      "cryptography              2.3.1\n",
      "cycler                    0.10.0\n",
      "Cython                    0.29.21\n",
      "dataclasses               0.8\n",
      "decorator                 4.4.2\n",
      "defusedxml                0.6.0\n",
      "dlib                      19.21.1\n",
      "dsw-demos-extension       0.1.0\n",
      "dsw-ipykernel             0.2.0\n",
      "dsw-magic                 0.0.1\n",
      "dsw-sql-extension         0.1.0\n",
      "dswdlv                    0.0.1\n",
      "dswmagic                  0.0.1\n",
      "entrypoints               0.3\n",
      "faiss                     1.4.0\n",
      "fasttext                  0.9.2\n",
      "ffmpeg-python             0.2.0\n",
      "flatbuffers               1.12\n",
      "future                    0.17.1\n",
      "gast                      0.3.3\n",
      "google-auth               1.27.1\n",
      "google-auth-oauthlib      0.4.3\n",
      "google-pasta              0.2.0\n",
      "graphviz                  0.16\n",
      "grpcio                    1.32.0\n",
      "h5py                      2.10.0\n",
      "idna                      2.10\n",
      "imbalanced-learn          0.3.1\n",
      "importlib-metadata        3.3.0\n",
      "ipykernel                 5.4.2\n",
      "ipython                   7.9.0\n",
      "ipython-genutils          0.2.0\n",
      "jedi                      0.17.2\n",
      "Jinja2                    2.11.2\n",
      "jmespath                  0.9.4\n",
      "joblib                    1.0.0\n",
      "json5                     0.9.5\n",
      "jsonschema                3.2.0\n",
      "jupyter-client            6.1.7\n",
      "jupyter-core              4.7.0\n",
      "jupyterlab                2.2.8\n",
      "jupyterlab-launcher       0.13.1\n",
      "jupyterlab-prometheus     0.1\n",
      "jupyterlab-pygments       0.1.2\n",
      "jupyterlab-server         1.2.0\n",
      "Keras                     2.2.4\n",
      "Keras-Applications        1.0.8\n",
      "Keras-Preprocessing       1.1.2\n",
      "kiwisolver                1.2.0\n",
      "libarchive-c              2.8\n",
      "lightgbm                  2.3.1\n",
      "Markdown                  3.1.1\n",
      "MarkupSafe                1.1.1\n",
      "matplotlib                3.3.3\n",
      "mistune                   0.8.4\n",
      "mkl-fft                   1.0.4\n",
      "mkl-random                1.0.1\n",
      "nbclient                  0.5.1\n",
      "nbconvert                 6.0.7\n",
      "nbformat                  5.0.8\n",
      "nest-asyncio              1.4.3\n",
      "notebook                  6.1.6\n",
      "np-utils                  0.5.10.0\n",
      "numpy                     1.19.4\n",
      "oauthlib                  3.1.0\n",
      "odps                      3.5.1\n",
      "olefile                   0.46\n",
      "open-from-url             0.1.0\n",
      "opencv-python             4.5.4.60\n",
      "opt-einsum                3.3.0\n",
      "oss2                      2.8.0\n",
      "packaging                 20.8\n",
      "palettable                3.3.0\n",
      "pandas                    1.1.5\n",
      "pandocfilters             1.4.3\n",
      "parso                     0.7.1\n",
      "pexpect                   4.8.0\n",
      "pickleshare               0.7.5\n",
      "Pillow                    8.0.1\n",
      "pip                       21.0.1\n",
      "prometheus-client         0.9.0\n",
      "prompt-toolkit            2.0.10\n",
      "protobuf                  3.15.5\n",
      "ptyprocess                0.7.0\n",
      "pyasn1                    0.4.8\n",
      "pyasn1-modules            0.2.8\n",
      "pybind11                  2.6.1\n",
      "pycosat                   0.6.3\n",
      "pycparser                 2.20\n",
      "pycryptodome              3.8.2\n",
      "Pygments                  2.7.3\n",
      "pymars                    0.6.1\n",
      "pyodps                    0.10.3\n",
      "pyOpenSSL                 17.5.0\n",
      "pyparsing                 2.4.7\n",
      "pyrsistent                0.17.3\n",
      "PySocks                   1.6.7\n",
      "python-dateutil           2.8.1\n",
      "python-dotenv             0.15.0\n",
      "pytz                      2020.5\n",
      "PyYAML                    6.0\n",
      "pyzmq                     20.0.0\n",
      "requests                  2.25.1\n",
      "requests-oauthlib         1.3.0\n",
      "rsa                       4.7.2\n",
      "ruamel-yaml               0.11.14\n",
      "scikit-learn              0.24.0\n",
      "scipy                     1.5.4\n",
      "seaborn                   0.11.2\n",
      "Send2Trash                1.5.0\n",
      "setuptools                51.1.1\n",
      "six                       1.15.0\n",
      "sklearn                   0.0\n",
      "sqlflow                   0.15.0.dev0\n",
      "tensorboard               2.4.1\n",
      "tensorboard-plugin-wit    1.8.0\n",
      "tensorflow                1.14.0\n",
      "tensorflow-cpu            2.4.0\n",
      "tensorflow-estimator      2.4.0\n",
      "tensorflow-io             0.7.0\n",
      "termcolor                 1.1.0\n",
      "terminado                 0.9.1\n",
      "testpath                  0.4.4\n",
      "thop                      0.0.31.post2005241907\n",
      "threadpoolctl             2.1.0\n",
      "tianchi-extension         0.1.0\n",
      "torch                     1.10.0\n",
      "torchvision               0.11.1\n",
      "tornado                   6.1\n",
      "tqdm                      4.62.3\n",
      "traitlets                 4.3.3\n",
      "typing-extensions         3.7.4.3\n",
      "urllib3                   1.26.2\n",
      "wcwidth                   0.2.5\n",
      "webencodings              0.5.1\n",
      "Werkzeug                  0.15.5\n",
      "wheel                     0.36.2\n",
      "wrapt                     1.12.1\n",
      "xgboost                   0.90\n",
      "zipp                      3.4.0\n",
      "\u001b[33mWARNING: You are using pip version 21.0.1; however, version 21.3.1 is available.\n",
      "You should consider upgrading via the '/opt/conda/bin/python -m pip install --upgrade pip' command.\u001b[0m\n",
      "Note: you may need to restart the kernel to use updated packages.\n"
     ]
    }
   ],
   "source": [
    "pip list"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [],
   "source": [
    "# makeTxt.py\n",
    "import os\n",
    "import random\n",
    "\n",
    "trainval_percent = 0.1\n",
    "train_percent = 0.9\n",
    "xmlfilepath = 'data/Annotations'\n",
    "txtsavepath = 'data/ImageSets'\n",
    "total_xml = os.listdir(xmlfilepath)\n",
    "\n",
    "num = len(total_xml)\n",
    "list = range(num)\n",
    "tv = int(num * trainval_percent)\n",
    "tr = int(tv * train_percent)\n",
    "trainval = random.sample(list, tv)\n",
    "train = random.sample(trainval, tr)\n",
    "\n",
    "ftrainval = open('data/ImageSets/trainval.txt', 'w')\n",
    "ftest = open('data/ImageSets/test.txt', 'w')\n",
    "ftrain = open('data/ImageSets/train.txt', 'w')\n",
    "fval = open('data/ImageSets/val.txt', 'w')\n",
    "\n",
    "for i in list:\n",
    "    name = total_xml[i][:-4] + '\\n'\n",
    "    if i in trainval:\n",
    "        ftrainval.write(name)\n",
    "        if i in train:\n",
    "            ftest.write(name)\n",
    "        else:\n",
    "            fval.write(name)\n",
    "    else:\n",
    "        ftrain.write(name)\n",
    "\n",
    "ftrainval.close()\n",
    "ftrain.close()\n",
    "fval.close()\n",
    "ftest.close()\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "/data/nas/workspace/jupyter/roboncon-vision\n"
     ]
    }
   ],
   "source": [
    "# voc_label.py\n",
    "import xml.etree.ElementTree as ET\n",
    "import pickle\n",
    "import os\n",
    "from os import listdir, getcwd\n",
    "from os.path import join\n",
    "\n",
    "sets = ['train', 'test', 'val']\n",
    "\n",
    "classes = [\"tower\"]  # 我们只是检测细胞，因此只有一个类别\n",
    "\n",
    "\n",
    "def convert(size, box):\n",
    "    dw = 1. / size[0]\n",
    "    dh = 1. / size[1]\n",
    "    x = (box[0] + box[1]) / 2.0\n",
    "    y = (box[2] + box[3]) / 2.0\n",
    "    w = box[1] - box[0]\n",
    "    h = box[3] - box[2]\n",
    "    x = x * dw\n",
    "    w = w * dw\n",
    "    y = y * dh\n",
    "    h = h * dh\n",
    "    return (x, y, w, h)\n",
    "\n",
    "\n",
    "def convert_annotation(image_id):\n",
    "    in_file = open('data/Annotations/%s.xml' % (image_id))\n",
    "    out_file = open('data/labels/%s.txt' % (image_id), 'w')\n",
    "    tree = ET.parse(in_file)\n",
    "    root = tree.getroot()\n",
    "    size = root.find('size')\n",
    "    w = int(size.find('width').text)\n",
    "    h = int(size.find('height').text)\n",
    "\n",
    "    for obj in root.iter('object'):\n",
    "        difficult = obj.find('difficult').text\n",
    "        cls = obj.find('name').text\n",
    "        if cls not in classes or int(difficult) == 1:\n",
    "            continue\n",
    "        cls_id = classes.index(cls)\n",
    "        xmlbox = obj.find('bndbox')\n",
    "        b = (float(xmlbox.find('xmin').text), float(xmlbox.find('xmax').text),\n",
    "             float(xmlbox.find('ymin').text), float(xmlbox.find('ymax').text))\n",
    "        bb = convert((w, h), b)\n",
    "        out_file.write(\n",
    "            str(cls_id) + \" \" + \" \".join([str(a) for a in bb]) + '\\n')\n",
    "\n",
    "\n",
    "wd = getcwd()\n",
    "print(wd)\n",
    "for image_set in sets:\n",
    "    if not os.path.exists('data/labels/'):\n",
    "        os.makedirs('data/labels/')\n",
    "    image_ids = open('data/ImageSets/%s.txt' %\n",
    "                     (image_set)).read().strip().split()\n",
    "    list_file = open('data/%s.txt' % (image_set), 'w')\n",
    "    for image_id in image_ids:\n",
    "        list_file.write('data/images/%s.jpg\\n' % (image_id))\n",
    "        convert_annotation(image_id)\n",
    "    list_file.close()\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {},
   "outputs": [],
   "source": [
    "# train\n",
    "import train "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {},
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "\u001b[34m\u001b[1mtrain: \u001b[0mweights=yolov3.pt, cfg=, data=dataset.yaml, hyp=data/hyps/hyp.scratch.yaml, epochs=100, batch_size=16, imgsz=640, rect=False, resume=False, nosave=False, noval=False, noautoanchor=False, evolve=None, bucket=, cache=None, image_weights=False, device=0, multi_scale=False, single_cls=False, adam=False, sync_bn=False, workers=8, project=runs/train, name=exp, exist_ok=False, quad=False, linear_lr=False, label_smoothing=0.0, patience=100, freeze=0, save_period=-1, local_rank=-1, entity=None, upload_dataset=False, bbox_interval=-1, artifact_alias=latest, epoch=300\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "\u001b[34m\u001b[1mgithub: \u001b[0mCommand 'git fetch && git config --get remote.origin.url' returned non-zero exit status 128.\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "YOLOv3 🚀 13e1ea3 torch 1.10.0+cu102 CUDA:0 (Tesla V100-SXM2-16GB, 7532MiB)\n",
      "\n",
      "\u001b[34m\u001b[1mhyperparameters: \u001b[0mlr0=0.01, lrf=0.1, momentum=0.937, weight_decay=0.0005, warmup_epochs=3.0, warmup_momentum=0.8, warmup_bias_lr=0.1, box=0.05, cls=0.5, cls_pw=1.0, obj=1.0, obj_pw=1.0, iou_t=0.2, anchor_t=4.0, fl_gamma=0.0, hsv_h=0.015, hsv_s=0.7, hsv_v=0.4, degrees=0.0, translate=0.1, scale=0.5, shear=0.0, perspective=0.0, flipud=0.0, fliplr=0.5, mosaic=1.0, mixup=0.0, copy_paste=0.0\n",
      "\u001b[34m\u001b[1mTensorBoard: \u001b[0mStart with 'tensorboard --logdir runs/train', view at http://localhost:6006/\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "\u001b[34m\u001b[1mWeights & Biases: \u001b[0mrun 'pip install wandb' to automatically track and visualize YOLOv3 🚀 runs (RECOMMENDED)\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "Overriding model.yaml nc=80 with nc=1\n",
      "\n",
      "                 from  n    params  module                                  arguments                     \n",
      "  0                -1  1       928  models.common.Conv                      [3, 32, 3, 1]                 \n",
      "  1                -1  1     18560  models.common.Conv                      [32, 64, 3, 2]                \n",
      "  2                -1  1     20672  models.common.Bottleneck                [64, 64]                      \n",
      "  3                -1  1     73984  models.common.Conv                      [64, 128, 3, 2]               \n",
      "  4                -1  2    164608  models.common.Bottleneck                [128, 128]                    \n",
      "  5                -1  1    295424  models.common.Conv                      [128, 256, 3, 2]              \n",
      "  6                -1  8   2627584  models.common.Bottleneck                [256, 256]                    \n",
      "  7                -1  1   1180672  models.common.Conv                      [256, 512, 3, 2]              \n",
      "  8                -1  8  10498048  models.common.Bottleneck                [512, 512]                    \n",
      "  9                -1  1   4720640  models.common.Conv                      [512, 1024, 3, 2]             \n",
      " 10                -1  4  20983808  models.common.Bottleneck                [1024, 1024]                  \n",
      " 11                -1  1   5245952  models.common.Bottleneck                [1024, 1024, False]           \n",
      " 12                -1  1    525312  models.common.Conv                      [1024, 512, [1, 1]]           \n",
      " 13                -1  1   4720640  models.common.Conv                      [512, 1024, 3, 1]             \n",
      " 14                -1  1    525312  models.common.Conv                      [1024, 512, 1, 1]             \n",
      " 15                -1  1   4720640  models.common.Conv                      [512, 1024, 3, 1]             \n",
      " 16                -2  1    131584  models.common.Conv                      [512, 256, 1, 1]              \n",
      " 17                -1  1         0  torch.nn.modules.upsampling.Upsample    [None, 2, 'nearest']          \n",
      " 18           [-1, 8]  1         0  models.common.Concat                    [1]                           \n",
      " 19                -1  1   1377792  models.common.Bottleneck                [768, 512, False]             \n",
      " 20                -1  1   1312256  models.common.Bottleneck                [512, 512, False]             \n",
      " 21                -1  1    131584  models.common.Conv                      [512, 256, 1, 1]              \n",
      " 22                -1  1   1180672  models.common.Conv                      [256, 512, 3, 1]              \n",
      " 23                -2  1     33024  models.common.Conv                      [256, 128, 1, 1]              \n",
      " 24                -1  1         0  torch.nn.modules.upsampling.Upsample    [None, 2, 'nearest']          \n",
      " 25           [-1, 6]  1         0  models.common.Concat                    [1]                           \n",
      " 26                -1  1    344832  models.common.Bottleneck                [384, 256, False]             \n",
      " 27                -1  2    656896  models.common.Bottleneck                [256, 256, False]             \n",
      " 28      [27, 22, 15]  1     32310  models.yolo.Detect                      [1, [[10, 13, 16, 30, 33, 23], [30, 61, 62, 45, 59, 119], [116, 90, 156, 198, 373, 326]], [256, 512, 1024]]\n",
      "Model Summary: 333 layers, 61523734 parameters, 61523734 gradients, 154.9 GFLOPs\n",
      "\n",
      "Transferred 433/439 items from yolov3.pt\n",
      "Scaled weight_decay = 0.0005\n",
      "\u001b[34m\u001b[1moptimizer:\u001b[0m SGD with parameter groups 72 weight, 75 weight (no decay), 75 bias\n",
      "\u001b[34m\u001b[1mtrain: \u001b[0mScanning 'data/train' images and labels...43 found, 0 missing, 0 empty, 4 corrupted: 100%|██████████| 47/47 [00:00<00:00, 72.36it/s]\n",
      "\u001b[34m\u001b[1mtrain: \u001b[0mWARNING: data/images/tower_0021.jpg: ignoring corrupt image/label: image file is truncated (46 bytes not processed)\n",
      "\u001b[34m\u001b[1mtrain: \u001b[0mWARNING: data/images/tower_0022.jpg: ignoring corrupt image/label: image file is truncated (61 bytes not processed)\n",
      "\u001b[34m\u001b[1mtrain: \u001b[0mWARNING: data/images/tower_0023.jpg: ignoring corrupt image/label: image file is truncated (67 bytes not processed)\n",
      "\u001b[34m\u001b[1mtrain: \u001b[0mWARNING: data/images/tower_0024.jpg: ignoring corrupt image/label: image file is truncated (9 bytes not processed)\n",
      "\u001b[34m\u001b[1mtrain: \u001b[0mNew cache created: data/train.cache\n",
      "\u001b[34m\u001b[1mval: \u001b[0mScanning 'data/val' images and labels...1 found, 0 missing, 0 empty, 0 corrupted: 100%|██████████| 1/1 [00:00<00:00,  5.86it/s]\n",
      "\u001b[34m\u001b[1mval: \u001b[0mNew cache created: data/val.cache\n",
      "Plotting labels to runs/train/exp/labels.jpg... \n",
      "\n",
      "\u001b[34m\u001b[1mAutoAnchor: \u001b[0m4.44 anchors/target, 1.000 Best Possible Recall (BPR). Current anchors are a good fit to dataset ✅\n",
      "Image sizes 640 train, 640 val\n",
      "Using 8 dataloader workers\n",
      "Logging results to \u001b[1mruns/train/exp\u001b[0m\n",
      "Starting training for 100 epochs...\n",
      "\n",
      "     Epoch   gpu_mem       box       obj       cls    labels  img_size\n",
      "      0/99     11.1G     0.124   0.02737         0        18       640: 100%|███\n",
      "               Class     Images     Labels          P          R     mAP@.5 mAP@\n",
      "                 all          1          1    0.00339          1    0.00357   0.000357\n",
      "\n",
      "     Epoch   gpu_mem       box       obj       cls    labels  img_size\n",
      "      1/99     11.1G    0.1216   0.02949         0        22       640: 100%|███\n",
      "               Class     Images     Labels          P          R     mAP@.5 mAP@\n",
      "                 all          1          1    0.00333          1    0.00358   0.000716\n",
      "\n",
      "     Epoch   gpu_mem       box       obj       cls    labels  img_size\n",
      "      2/99     11.1G    0.1155   0.02963         0        24       640: 100%|███\n",
      "               Class     Images     Labels          P          R     mAP@.5 mAP@\n",
      "                 all          1          1    0.00341          1    0.00377    0.00151\n",
      "\n",
      "     Epoch   gpu_mem       box       obj       cls    labels  img_size\n",
      "      3/99     11.1G    0.1011   0.03041         0        21       640: 100%|███\n",
      "               Class     Images     Labels          P          R     mAP@.5 mAP@\n",
      "                 all          1          1     0.0146          1     0.0158    0.00158\n",
      "\n",
      "     Epoch   gpu_mem       box       obj       cls    labels  img_size\n",
      "      4/99     11.1G   0.09429   0.03115         0        20       640: 100%|███\n",
      "               Class     Images     Labels          P          R     mAP@.5 mAP@\n",
      "                 all          1          1     0.0144          1     0.0158    0.00158\n",
      "\n",
      "     Epoch   gpu_mem       box       obj       cls    labels  img_size\n",
      "      5/99     11.1G   0.08481    0.0299         0        18       640: 100%|███\n",
      "               Class     Images     Labels          P          R     mAP@.5 mAP@\n",
      "                 all          1          1     0.0162          1     0.0175    0.00349\n",
      "\n",
      "     Epoch   gpu_mem       box       obj       cls    labels  img_size\n",
      "      6/99     11.1G   0.08102   0.03175         0        23       640: 100%|███\n",
      "               Class     Images     Labels          P          R     mAP@.5 mAP@\n",
      "                 all          1          1     0.0166          1     0.0181    0.00362\n",
      "\n",
      "     Epoch   gpu_mem       box       obj       cls    labels  img_size\n",
      "      7/99     11.1G   0.07992   0.03173         0        21       640: 100%|███\n",
      "               Class     Images     Labels          P          R     mAP@.5 mAP@\n",
      "                 all          1          1      0.017          1     0.0203    0.00406\n",
      "\n",
      "     Epoch   gpu_mem       box       obj       cls    labels  img_size\n",
      "      8/99     11.1G   0.07103    0.0331         0        21       640: 100%|███\n",
      "               Class     Images     Labels          P          R     mAP@.5 mAP@\n",
      "                 all          1          1     0.0212          1     0.0221    0.00884\n",
      "\n",
      "     Epoch   gpu_mem       box       obj       cls    labels  img_size\n",
      "      9/99     11.1G   0.05973   0.02893         0        14       640: 100%|███\n",
      "               Class     Images     Labels          P          R     mAP@.5 mAP@\n",
      "                 all          1          1     0.0217          1     0.0221    0.00663\n",
      "\n",
      "     Epoch   gpu_mem       box       obj       cls    labels  img_size\n",
      "     10/99     11.1G   0.06179   0.03419         0        22       640: 100%|███\n",
      "               Class     Images     Labels          P          R     mAP@.5 mAP@\n",
      "                 all          1          1     0.0275          1     0.0284    0.00853\n",
      "\n",
      "     Epoch   gpu_mem       box       obj       cls    labels  img_size\n",
      "     11/99     11.1G   0.06428   0.03165         0        24       640: 100%|███\n",
      "               Class     Images     Labels          P          R     mAP@.5 mAP@\n",
      "                 all          1          1     0.0467          1     0.0622     0.0249\n",
      "\n",
      "     Epoch   gpu_mem       box       obj       cls    labels  img_size\n",
      "     12/99     11.1G   0.06012    0.0316         0        25       640: 100%|███\n",
      "               Class     Images     Labels          P          R     mAP@.5 mAP@\n",
      "                 all          1          1      0.108          1      0.111     0.0442\n",
      "\n",
      "     Epoch   gpu_mem       box       obj       cls    labels  img_size\n",
      "     13/99     11.1G   0.04693   0.03074         0        14       640: 100%|███\n",
      "               Class     Images     Labels          P          R     mAP@.5 mAP@\n",
      "                 all          1          1      0.912          1      0.995      0.398\n",
      "\n",
      "     Epoch   gpu_mem       box       obj       cls    labels  img_size\n",
      "     14/99     11.1G   0.05469   0.03098         0        18       640: 100%|███\n",
      "               Class     Images     Labels          P          R     mAP@.5 mAP@\n",
      "                 all          1          1      0.967          1      0.995      0.298\n",
      "\n",
      "     Epoch   gpu_mem       box       obj       cls    labels  img_size\n",
      "     15/99     11.1G   0.05047    0.0291         0        17       640: 100%|███\n",
      "               Class     Images     Labels          P          R     mAP@.5 mAP@\n",
      "                 all          1          1       0.99          1      0.995      0.398\n",
      "\n",
      "     Epoch   gpu_mem       box       obj       cls    labels  img_size\n",
      "     16/99     11.1G   0.06165   0.02663         0        19       640: 100%|███\n",
      "               Class     Images     Labels          P          R     mAP@.5 mAP@\n",
      "                 all          1          1      0.979          1      0.995      0.398\n",
      "\n",
      "     Epoch   gpu_mem       box       obj       cls    labels  img_size\n",
      "     17/99     11.1G   0.04887    0.0316         0        25       640: 100%|███\n",
      "               Class     Images     Labels          P          R     mAP@.5 mAP@\n",
      "                 all          1          1      0.983          1      0.995      0.398\n",
      "\n",
      "     Epoch   gpu_mem       box       obj       cls    labels  img_size\n",
      "     18/99     11.1G   0.05134   0.02951         0        20       640: 100%|███\n",
      "               Class     Images     Labels          P          R     mAP@.5 mAP@\n",
      "                 all          1          1      0.997          1      0.995      0.398\n",
      "\n",
      "     Epoch   gpu_mem       box       obj       cls    labels  img_size\n",
      "     19/99     11.1G   0.04463   0.03107         0        19       640: 100%|███\n",
      "               Class     Images     Labels          P          R     mAP@.5 mAP@\n",
      "                 all          1          1      0.996          1      0.995      0.497\n",
      "\n",
      "     Epoch   gpu_mem       box       obj       cls    labels  img_size\n",
      "     20/99     11.1G   0.04621   0.03181         0        28       640: 100%|███\n",
      "               Class     Images     Labels          P          R     mAP@.5 mAP@\n",
      "                 all          1          1      0.997          1      0.995      0.697\n",
      "\n",
      "     Epoch   gpu_mem       box       obj       cls    labels  img_size\n",
      "     21/99     11.1G   0.04665   0.02955         0        26       640: 100%|███\n",
      "               Class     Images     Labels          P          R     mAP@.5 mAP@\n",
      "                 all          1          1      0.999          1      0.995      0.597\n",
      "\n",
      "     Epoch   gpu_mem       box       obj       cls    labels  img_size\n",
      "     22/99     11.1G   0.04479   0.02815         0        24       640: 100%|███\n",
      "               Class     Images     Labels          P          R     mAP@.5 mAP@\n",
      "                 all          1          1          1          1      0.995      0.497\n",
      "\n",
      "     Epoch   gpu_mem       box       obj       cls    labels  img_size\n",
      "     23/99     11.1G   0.03512   0.02183         0        15       640: 100%|███\n",
      "               Class     Images     Labels          P          R     mAP@.5 mAP@\n",
      "                 all          1          1      0.999          1      0.995     0.0995\n",
      "\n",
      "     Epoch   gpu_mem       box       obj       cls    labels  img_size\n",
      "     24/99     11.1G   0.04606   0.02534         0        22       640: 100%|███\n",
      "               Class     Images     Labels          P          R     mAP@.5 mAP@\n",
      "                 all          1          1          1          1      0.995      0.796\n",
      "\n",
      "     Epoch   gpu_mem       box       obj       cls    labels  img_size\n",
      "     25/99     11.1G   0.04024   0.02278         0        23       640: 100%|███\n",
      "               Class     Images     Labels          P          R     mAP@.5 mAP@\n",
      "                 all          1          1          1          1      0.995      0.697\n",
      "\n",
      "     Epoch   gpu_mem       box       obj       cls    labels  img_size\n",
      "     26/99     11.1G   0.05044   0.02229         0        24       640: 100%|███\n",
      "               Class     Images     Labels          P          R     mAP@.5 mAP@\n",
      "                 all          1          1      0.999          1      0.995      0.697\n",
      "\n",
      "     Epoch   gpu_mem       box       obj       cls    labels  img_size\n",
      "     27/99     11.1G   0.04172     0.024         0        24       640: 100%|███\n",
      "               Class     Images     Labels          P          R     mAP@.5 mAP@\n",
      "                 all          1          1          1          1      0.995      0.597\n",
      "\n",
      "     Epoch   gpu_mem       box       obj       cls    labels  img_size\n",
      "     28/99     11.1G   0.04218   0.02054         0        21       640: 100%|███\n",
      "               Class     Images     Labels          P          R     mAP@.5 mAP@\n",
      "                 all          1          1          1          1      0.995      0.697\n",
      "\n",
      "     Epoch   gpu_mem       box       obj       cls    labels  img_size\n",
      "     29/99     11.1G   0.04157   0.02085         0        21       640: 100%|███\n",
      "               Class     Images     Labels          P          R     mAP@.5 mAP@\n",
      "                 all          1          1      0.999          1      0.995      0.298\n",
      "\n",
      "     Epoch   gpu_mem       box       obj       cls    labels  img_size\n",
      "     30/99     11.1G   0.04794   0.02072         0        26       640: 100%|███\n",
      "               Class     Images     Labels          P          R     mAP@.5 mAP@\n",
      "                 all          1          1          1          1      0.995      0.796\n",
      "\n",
      "     Epoch   gpu_mem       box       obj       cls    labels  img_size\n",
      "     31/99     11.1G     0.042   0.01928         0        27       640: 100%|███\n",
      "               Class     Images     Labels          P          R     mAP@.5 mAP@\n",
      "                 all          1          1          1          1      0.995      0.398\n",
      "\n",
      "     Epoch   gpu_mem       box       obj       cls    labels  img_size\n",
      "     32/99     11.1G   0.04523   0.01989         0        25       640: 100%|███\n",
      "               Class     Images     Labels          P          R     mAP@.5 mAP@\n",
      "                 all          1          1          1          1      0.995      0.697\n",
      "\n",
      "     Epoch   gpu_mem       box       obj       cls    labels  img_size\n",
      "     33/99     11.1G   0.04377   0.01512         0        15       640: 100%|███\n",
      "               Class     Images     Labels          P          R     mAP@.5 mAP@\n",
      "                 all          1          1      0.999          1      0.995      0.796\n",
      "\n",
      "     Epoch   gpu_mem       box       obj       cls    labels  img_size\n",
      "     34/99     11.1G   0.04848   0.01751         0        24       640: 100%|███\n",
      "               Class     Images     Labels          P          R     mAP@.5 mAP@\n",
      "                 all          1          1          1          1      0.995      0.398\n",
      "\n",
      "     Epoch   gpu_mem       box       obj       cls    labels  img_size\n",
      "     35/99     11.1G   0.04382    0.0173         0        25       640: 100%|███\n",
      "               Class     Images     Labels          P          R     mAP@.5 mAP@\n",
      "                 all          1          1          1          1      0.995      0.697\n",
      "\n",
      "     Epoch   gpu_mem       box       obj       cls    labels  img_size\n",
      "     36/99     11.1G   0.04405   0.01689         0        21       640: 100%|███\n",
      "               Class     Images     Labels          P          R     mAP@.5 mAP@\n",
      "                 all          1          1          1          1      0.995      0.398\n",
      "\n",
      "     Epoch   gpu_mem       box       obj       cls    labels  img_size\n",
      "     37/99     11.1G   0.04237   0.01847         0        19       640: 100%|███\n",
      "               Class     Images     Labels          P          R     mAP@.5 mAP@\n",
      "                 all          1          1      0.999          1      0.995      0.597\n",
      "\n",
      "     Epoch   gpu_mem       box       obj       cls    labels  img_size\n",
      "     38/99     11.1G   0.04554   0.01589         0        27       640: 100%|███\n",
      "               Class     Images     Labels          P          R     mAP@.5 mAP@\n",
      "                 all          1          1        0.5          1      0.497      0.348\n",
      "\n",
      "     Epoch   gpu_mem       box       obj       cls    labels  img_size\n",
      "     39/99     11.1G   0.04032   0.01573         0        19       640: 100%|███\n",
      "               Class     Images     Labels          P          R     mAP@.5 mAP@\n",
      "                 all          1          1          1          1      0.995      0.697\n",
      "\n",
      "     Epoch   gpu_mem       box       obj       cls    labels  img_size\n",
      "     40/99     11.1G   0.03608    0.0163         0        18       640: 100%|███\n",
      "               Class     Images     Labels          P          R     mAP@.5 mAP@\n",
      "                 all          1          1          1          1      0.995      0.697\n",
      "\n",
      "     Epoch   gpu_mem       box       obj       cls    labels  img_size\n",
      "     41/99     11.1G   0.03677   0.01524         0        23       640: 100%|███\n",
      "               Class     Images     Labels          P          R     mAP@.5 mAP@\n",
      "                 all          1          1          1          1      0.995      0.895\n",
      "\n",
      "     Epoch   gpu_mem       box       obj       cls    labels  img_size\n",
      "     42/99     11.1G   0.03698   0.01572         0        22       640: 100%|███\n",
      "               Class     Images     Labels          P          R     mAP@.5 mAP@\n",
      "                 all          1          1      0.999          1      0.995      0.398\n",
      "\n",
      "     Epoch   gpu_mem       box       obj       cls    labels  img_size\n",
      "     43/99     11.1G   0.03673   0.01663         0        24       640: 100%|███\n",
      "               Class     Images     Labels          P          R     mAP@.5 mAP@\n",
      "                 all          1          1      0.999          1      0.995      0.597\n",
      "\n",
      "     Epoch   gpu_mem       box       obj       cls    labels  img_size\n",
      "     44/99     11.1G   0.03597   0.01552         0        19       640: 100%|███\n",
      "               Class     Images     Labels          P          R     mAP@.5 mAP@\n",
      "                 all          1          1          1          1      0.995      0.796\n",
      "\n",
      "     Epoch   gpu_mem       box       obj       cls    labels  img_size\n",
      "     45/99     11.1G   0.03652   0.01429         0        20       640: 100%|███\n",
      "               Class     Images     Labels          P          R     mAP@.5 mAP@\n",
      "                 all          1          1          1          1      0.995      0.497\n",
      "\n",
      "     Epoch   gpu_mem       box       obj       cls    labels  img_size\n",
      "     46/99     11.1G   0.03465    0.0142         0        11       640: 100%|███\n",
      "               Class     Images     Labels          P          R     mAP@.5 mAP@\n",
      "                 all          1          1      0.999          1      0.995      0.697\n",
      "\n",
      "     Epoch   gpu_mem       box       obj       cls    labels  img_size\n",
      "     47/99     11.1G   0.04196   0.01391         0        17       640: 100%|███\n",
      "               Class     Images     Labels          P          R     mAP@.5 mAP@\n",
      "                 all          1          1      0.999          1      0.995      0.597\n",
      "\n",
      "     Epoch   gpu_mem       box       obj       cls    labels  img_size\n",
      "     48/99     11.1G   0.03018   0.01441         0        17       640: 100%|███\n",
      "               Class     Images     Labels          P          R     mAP@.5 mAP@\n",
      "                 all          1          1          1          1      0.995      0.796\n",
      "\n",
      "     Epoch   gpu_mem       box       obj       cls    labels  img_size\n",
      "     49/99     11.1G    0.0344   0.01469         0        21       640: 100%|███\n",
      "               Class     Images     Labels          P          R     mAP@.5 mAP@\n",
      "                 all          1          1          1          1      0.995      0.796\n",
      "\n",
      "     Epoch   gpu_mem       box       obj       cls    labels  img_size\n",
      "     50/99     11.1G   0.03662   0.01529         0        23       640: 100%|███\n",
      "               Class     Images     Labels          P          R     mAP@.5 mAP@\n",
      "                 all          1          1          1          1      0.995      0.796\n",
      "\n",
      "     Epoch   gpu_mem       box       obj       cls    labels  img_size\n",
      "     51/99     11.1G   0.03337    0.0146         0        18       640: 100%|███\n",
      "               Class     Images     Labels          P          R     mAP@.5 mAP@\n",
      "                 all          1          1          1          1      0.995      0.697\n",
      "\n",
      "     Epoch   gpu_mem       box       obj       cls    labels  img_size\n",
      "     52/99     11.1G   0.03519   0.01356         0        23       640: 100%|███\n",
      "               Class     Images     Labels          P          R     mAP@.5 mAP@\n",
      "                 all          1          1          1          1      0.995      0.597\n",
      "\n",
      "     Epoch   gpu_mem       box       obj       cls    labels  img_size\n",
      "     53/99     11.1G   0.03405    0.0135         0        20       640: 100%|███\n",
      "               Class     Images     Labels          P          R     mAP@.5 mAP@\n",
      "                 all          1          1          1          1      0.995      0.697\n",
      "\n",
      "     Epoch   gpu_mem       box       obj       cls    labels  img_size\n",
      "     54/99     11.1G   0.03757   0.01236         0        16       640: 100%|███\n",
      "               Class     Images     Labels          P          R     mAP@.5 mAP@\n",
      "                 all          1          1          1          1      0.995      0.895\n",
      "\n",
      "     Epoch   gpu_mem       box       obj       cls    labels  img_size\n",
      "     55/99     11.1G   0.03495   0.01351         0        21       640: 100%|███\n",
      "               Class     Images     Labels          P          R     mAP@.5 mAP@\n",
      "                 all          1          1          1          1      0.995      0.697\n",
      "\n",
      "     Epoch   gpu_mem       box       obj       cls    labels  img_size\n",
      "     56/99     11.1G   0.03119   0.01373         0        24       640: 100%|███\n",
      "               Class     Images     Labels          P          R     mAP@.5 mAP@\n",
      "                 all          1          1      0.994          1      0.995      0.199\n",
      "\n",
      "     Epoch   gpu_mem       box       obj       cls    labels  img_size\n",
      "     57/99     11.1G   0.04934   0.01329         0        23       640: 100%|███\n",
      "               Class     Images     Labels          P          R     mAP@.5 mAP@\n",
      "                 all          1          1      0.993          1      0.995     0.0995\n",
      "\n",
      "     Epoch   gpu_mem       box       obj       cls    labels  img_size\n",
      "     58/99     11.1G   0.04661    0.0141         0        24       640: 100%|███\n",
      "               Class     Images     Labels          P          R     mAP@.5 mAP@\n",
      "                 all          1          1      0.985          1      0.995      0.398\n",
      "\n",
      "     Epoch   gpu_mem       box       obj       cls    labels  img_size\n",
      "     59/99     11.1G   0.04374   0.01266         0        21       640: 100%|███\n",
      "               Class     Images     Labels          P          R     mAP@.5 mAP@\n",
      "                 all          1          1      0.995          1      0.995      0.199\n",
      "\n",
      "     Epoch   gpu_mem       box       obj       cls    labels  img_size\n",
      "     60/99     11.1G   0.03949   0.01217         0        19       640: 100%|███\n",
      "               Class     Images     Labels          P          R     mAP@.5 mAP@\n",
      "                 all          1          1      0.997          1      0.995      0.597\n",
      "\n",
      "     Epoch   gpu_mem       box       obj       cls    labels  img_size\n",
      "     61/99     11.1G   0.04144   0.01388         0        24       640: 100%|███\n",
      "               Class     Images     Labels          P          R     mAP@.5 mAP@\n",
      "                 all          1          1      0.998          1      0.995      0.398\n",
      "\n",
      "     Epoch   gpu_mem       box       obj       cls    labels  img_size\n",
      "     62/99     11.1G    0.0387   0.01352         0        21       640: 100%|███\n",
      "               Class     Images     Labels          P          R     mAP@.5 mAP@\n",
      "                 all          1          1      0.999          1      0.995      0.697\n",
      "\n",
      "     Epoch   gpu_mem       box       obj       cls    labels  img_size\n",
      "     63/99     11.1G   0.03982   0.01268         0        14       640: 100%|███\n",
      "               Class     Images     Labels          P          R     mAP@.5 mAP@\n",
      "                 all          1          1      0.992          1      0.995      0.298\n",
      "\n",
      "     Epoch   gpu_mem       box       obj       cls    labels  img_size\n",
      "     64/99     11.1G   0.03671   0.01198         0        15       640: 100%|███\n",
      "               Class     Images     Labels          P          R     mAP@.5 mAP@\n",
      "                 all          1          1          1          1      0.995      0.796\n",
      "\n",
      "     Epoch   gpu_mem       box       obj       cls    labels  img_size\n",
      "     65/99     11.1G   0.03236   0.01333         0        25       640: 100%|███\n",
      "               Class     Images     Labels          P          R     mAP@.5 mAP@\n",
      "                 all          1          1          1          1      0.995      0.796\n",
      "\n",
      "     Epoch   gpu_mem       box       obj       cls    labels  img_size\n",
      "     66/99     11.1G   0.03296   0.01395         0        19       640: 100%|███\n",
      "               Class     Images     Labels          P          R     mAP@.5 mAP@\n",
      "                 all          1          1          1          1      0.995      0.796\n",
      "\n",
      "     Epoch   gpu_mem       box       obj       cls    labels  img_size\n",
      "     67/99     11.1G   0.03456   0.01209         0        11       640: 100%|███\n",
      "               Class     Images     Labels          P          R     mAP@.5 mAP@\n",
      "                 all          1          1          1          1      0.995      0.497\n",
      "\n",
      "     Epoch   gpu_mem       box       obj       cls    labels  img_size\n",
      "               Class     Images     Labels          P          R     mAP@.5 mAP@\n",
      "                 all          1          1      0.999          1      0.995      0.597\n",
      "\n",
      "     Epoch   gpu_mem       box       obj       cls    labels  img_size\n",
      "     69/99     11.1G   0.03922   0.01339         0        19       640: 100%|███\n",
      "               Class     Images     Labels          P          R     mAP@.5 mAP@\n",
      "                 all          1          1      0.997          1      0.995      0.298\n",
      "\n",
      "     Epoch   gpu_mem       box       obj       cls    labels  img_size\n",
      "     70/99     11.1G   0.03402   0.01457         0        25       640: 100%|███\n",
      "               Class     Images     Labels          P          R     mAP@.5 mAP@\n",
      "                 all          1          1          1          1      0.995      0.398\n",
      "\n",
      "     Epoch   gpu_mem       box       obj       cls    labels  img_size\n",
      "     71/99     11.1G   0.02984   0.01177         0        25       640: 100%|███\n",
      "               Class     Images     Labels          P          R     mAP@.5 mAP@\n",
      "                 all          1          1          1          1      0.995      0.895\n",
      "\n",
      "     Epoch   gpu_mem       box       obj       cls    labels  img_size\n",
      "     72/99     11.1G   0.03203   0.01335         0        22       640: 100%|███\n",
      "               Class     Images     Labels          P          R     mAP@.5 mAP@\n",
      "                 all          1          1          1          1      0.995      0.597\n",
      "\n",
      "     Epoch   gpu_mem       box       obj       cls    labels  img_size\n",
      "     73/99     11.1G   0.03346   0.01463         0        30       640: 100%|███\n",
      "               Class     Images     Labels          P          R     mAP@.5 mAP@\n",
      "                 all          1          1          1          1      0.995      0.497\n",
      "\n",
      "     Epoch   gpu_mem       box       obj       cls    labels  img_size\n",
      "     74/99     11.1G   0.03516   0.01297         0        21       640: 100%|███\n",
      "               Class     Images     Labels          P          R     mAP@.5 mAP@\n",
      "                 all          1          1          1          1      0.995      0.597\n",
      "\n",
      "     Epoch   gpu_mem       box       obj       cls    labels  img_size\n",
      "     75/99     11.1G   0.04066   0.01306         0        23       640: 100%|███\n",
      "               Class     Images     Labels          P          R     mAP@.5 mAP@\n",
      "                 all          1          1      0.998          1      0.995      0.796\n",
      "\n",
      "     Epoch   gpu_mem       box       obj       cls    labels  img_size\n",
      "     76/99     11.1G    0.0323   0.01275         0        25       640: 100%|███\n",
      "               Class     Images     Labels          P          R     mAP@.5 mAP@\n",
      "                 all          1          1          1          1      0.995      0.796\n",
      "\n",
      "     Epoch   gpu_mem       box       obj       cls    labels  img_size\n",
      "     77/99     11.1G   0.03132   0.01165         0        19       640: 100%|███\n",
      "               Class     Images     Labels          P          R     mAP@.5 mAP@\n",
      "                 all          1          1          1          1      0.995      0.895\n",
      "\n",
      "     Epoch   gpu_mem       box       obj       cls    labels  img_size\n",
      "     78/99     11.1G    0.0251   0.01214         0        16       640: 100%|███\n",
      "               Class     Images     Labels          P          R     mAP@.5 mAP@\n",
      "                 all          1          1          1          1      0.995      0.597\n",
      "\n",
      "     Epoch   gpu_mem       box       obj       cls    labels  img_size\n",
      "     79/99     11.1G   0.03439   0.01297         0        22       640: 100%|███\n",
      "               Class     Images     Labels          P          R     mAP@.5 mAP@\n",
      "                 all          1          1          1          1      0.995      0.796\n",
      "\n",
      "     Epoch   gpu_mem       box       obj       cls    labels  img_size\n",
      "     80/99     11.1G   0.03078   0.01191         0        17       640: 100%|███\n",
      "               Class     Images     Labels          P          R     mAP@.5 mAP@\n",
      "                 all          1          1          1          1      0.995      0.697\n",
      "\n",
      "     Epoch   gpu_mem       box       obj       cls    labels  img_size\n",
      "     81/99     11.1G   0.03286   0.01198         0        19       640: 100%|███\n",
      "               Class     Images     Labels          P          R     mAP@.5 mAP@\n",
      "                 all          1          1      0.999          1      0.995      0.796\n",
      "\n",
      "     Epoch   gpu_mem       box       obj       cls    labels  img_size\n",
      "     82/99     11.1G   0.03074   0.01216         0        17       640: 100%|███\n",
      "               Class     Images     Labels          P          R     mAP@.5 mAP@\n",
      "                 all          1          1      0.999          1      0.995      0.597\n",
      "\n",
      "     Epoch   gpu_mem       box       obj       cls    labels  img_size\n",
      "     83/99     11.1G   0.03082   0.01181         0        18       640: 100%|███\n",
      "               Class     Images     Labels          P          R     mAP@.5 mAP@\n",
      "                 all          1          1      0.999          1      0.995      0.895\n",
      "\n",
      "     Epoch   gpu_mem       box       obj       cls    labels  img_size\n",
      "     84/99     11.1G    0.0286   0.01121         0        19       640: 100%|███\n",
      "               Class     Images     Labels          P          R     mAP@.5 mAP@\n",
      "                 all          1          1          1          1      0.995      0.697\n",
      "\n",
      "     Epoch   gpu_mem       box       obj       cls    labels  img_size\n",
      "     85/99     11.1G   0.03492   0.01292         0        23       640: 100%|███\n",
      "               Class     Images     Labels          P          R     mAP@.5 mAP@\n",
      "                 all          1          1          1          1      0.995      0.597\n",
      "\n",
      "     Epoch   gpu_mem       box       obj       cls    labels  img_size\n",
      "     86/99     11.1G   0.02693   0.01462         0        24       640: 100%|███\n",
      "               Class     Images     Labels          P          R     mAP@.5 mAP@\n",
      "                 all          1          1      0.999          1      0.995      0.697\n",
      "\n",
      "     Epoch   gpu_mem       box       obj       cls    labels  img_size\n",
      "     87/99     11.1G   0.03019   0.01201         0        21       640: 100%|███\n",
      "               Class     Images     Labels          P          R     mAP@.5 mAP@\n",
      "                 all          1          1          1          1      0.995      0.597\n",
      "\n",
      "     Epoch   gpu_mem       box       obj       cls    labels  img_size\n",
      "     88/99     11.1G   0.02914   0.01227         0        24       640: 100%|███\n",
      "               Class     Images     Labels          P          R     mAP@.5 mAP@\n",
      "                 all          1          1      0.999          1      0.995      0.697\n",
      "\n",
      "     Epoch   gpu_mem       box       obj       cls    labels  img_size\n",
      "     89/99     11.1G   0.02645   0.01266         0        21       640: 100%|███\n",
      "               Class     Images     Labels          P          R     mAP@.5 mAP@\n",
      "                 all          1          1      0.999          1      0.995      0.697\n",
      "\n",
      "     Epoch   gpu_mem       box       obj       cls    labels  img_size\n",
      "     90/99     11.1G    0.0276   0.01234         0        20       640: 100%|███\n",
      "               Class     Images     Labels          P          R     mAP@.5 mAP@\n",
      "                 all          1          1          1          1      0.995      0.995\n",
      "\n",
      "     Epoch   gpu_mem       box       obj       cls    labels  img_size\n",
      "     91/99     11.1G   0.02408   0.01138         0        21       640: 100%|███\n",
      "               Class     Images     Labels          P          R     mAP@.5 mAP@\n",
      "                 all          1          1          1          1      0.995      0.796\n",
      "\n",
      "     Epoch   gpu_mem       box       obj       cls    labels  img_size\n",
      "     92/99     11.1G   0.02526   0.01133         0        21       640: 100%|███\n",
      "               Class     Images     Labels          P          R     mAP@.5 mAP@\n",
      "                 all          1          1          1          1      0.995      0.895\n",
      "\n",
      "     Epoch   gpu_mem       box       obj       cls    labels  img_size\n",
      "     93/99     11.1G   0.02699   0.01218         0        30       640:  67%|███\n",
      "               Class     Images     Labels          P          R     mAP@.5 mAP@\n",
      "                 all          1          1          1          1      0.995      0.597\n",
      "\n",
      "     Epoch   gpu_mem       box       obj       cls    labels  img_size\n",
      "     94/99     11.1G   0.02819   0.01237         0        23       640: 100%|███\n",
      "               Class     Images     Labels          P          R     mAP@.5 mAP@\n",
      "                 all          1          1          1          1      0.995      0.895\n",
      "\n",
      "     Epoch   gpu_mem       box       obj       cls    labels  img_size\n",
      "     95/99     11.1G   0.02683   0.01134         0        27       640: 100%|███\n",
      "               Class     Images     Labels          P          R     mAP@.5 mAP@\n",
      "                 all          1          1          1          1      0.995      0.796\n",
      "\n",
      "     Epoch   gpu_mem       box       obj       cls    labels  img_size\n",
      "     96/99     11.1G   0.02797   0.01143         0        20       640: 100%|███\n",
      "               Class     Images     Labels          P          R     mAP@.5 mAP@\n",
      "                 all          1          1          1          1      0.995      0.895\n",
      "\n",
      "     Epoch   gpu_mem       box       obj       cls    labels  img_size\n",
      "     97/99     11.1G   0.02626   0.01194         0        28       640: 100%|███\n",
      "               Class     Images     Labels          P          R     mAP@.5 mAP@\n",
      "                 all          1          1          1          1      0.995      0.895\n",
      "\n",
      "     Epoch   gpu_mem       box       obj       cls    labels  img_size\n",
      "     98/99     11.1G   0.02684   0.01175         0        26       640: 100%|███\n",
      "               Class     Images     Labels          P          R     mAP@.5 mAP@\n",
      "                 all          1          1          1          1      0.995      0.796\n",
      "\n",
      "     Epoch   gpu_mem       box       obj       cls    labels  img_size\n",
      "     99/99     11.1G    0.0255   0.01239         0        28       640: 100%|███\n",
      "               Class     Images     Labels          P          R     mAP@.5 mAP@\n",
      "                 all          1          1          1          1      0.995      0.796\n",
      "\n",
      "100 epochs completed in 0.482 hours.\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Optimizer stripped from runs/train/exp/weights/last.pt, 123.5MB\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "\n",
      "Validating runs/train/exp/weights/best.pt...\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Optimizer stripped from runs/train/exp/weights/best.pt, 123.5MB\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "Fusing layers... \n",
      "Model Summary: 261 layers, 61497430 parameters, 0 gradients, 154.7 GFLOPs\n",
      "               Class     Images     Labels          P          R     mAP@.5 mAP@\n",
      "                 all          1          1          1          1      0.995      0.995\n",
      "Results saved to \u001b[1mruns/train/exp\u001b[0m\n"
     ]
    }
   ],
   "source": [
    "train.run(data='dataset.yaml', imgsz=640, weights='yolov3.pt',device=0,epoch=300, batch_size=16)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.6.9"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 4
}
